<?php

/**
 * Albireo Desktop
 *
 * @copyright  Copyright (c) 2010 Albireo Solutions
 * @package    Webtop
 */

namespace ApplicationsModule\ApplicationModule;

use WebtopModule\BasePresenter;
use Nette\Forms\SubmitButton;
use Albireo\Forms\AlbireoForm;

final class ApplicationPresenter extends BasePresenter {

    private $model;

    public function startup() {
        parent::startup();
        $this->model = new ApplicationModel($this->getUser());
        //$this->model->createApp($this->getHttpRequest()->getUri()->baseUri);
    }

    public function renderDefault() {
        $this->template->installed = $this->model->getInstalled();
        $this->template->notinstalled = $this->model->getNotInstalled();
    }

    public function actionInstall($id) {
        $this->model->install($id);
        $this->invalidateControl('table');
        $this->view = "default";
    }

    public function actionUninstall($id) {
        $this->model->uninstall($id);
        $this->invalidateControl('table');
        $this->view = "default";
    }
}